#include "test_spi.h"
bsp_gpio_init_t gpio_spi_cs = {
    0,//0:GPIOA,1:GPIOB
    2,//x:PINx
    0,//0:intput,1:output,reserve,not support;
    2,//0:Anolog,1:input,2:pushpull,3:OD
    0,//reserve,not support;
    0,//0:GPIO_IT_NONE,1:GPIO_IT_RISING,2:GPIO_IT_FALLING
    0,//0:GPIO_PULL_NONE,1:GPIO_PULL_UP
    3,//af3
};
bsp_gpio_init_t gpio_spi_sck = {
    0,//0:GPIOA,1:GPIOB
    5,//x:PINx
    0,//0:intput,1:output,reserve,not support;
    2,//0:Anolog,1:input,2:pushpull,3:OD
    0,//reserve,not support;
    0,//0:GPIO_IT_NONE,1:GPIO_IT_RISING,2:GPIO_IT_FALLING
    0,//0:GPIO_PULL_NONE,1:GPIO_PULL_UP
    3,//af3
};
bsp_gpio_init_t gpio_spi_mosi = {
    0,//0:GPIOA,1:GPIOB
    6,//x:PINx
    0,//0:intput,1:output,reserve,not support;
    2,//0:Anolog,1:input,2:pushpull,3:OD
    0,//reserve,not support;
    0,//0:GPIO_IT_NONE,1:GPIO_IT_RISING,2:GPIO_IT_FALLING
    0,//0:GPIO_PULL_NONE,1:GPIO_PULL_UP
    3,//af3
};
bsp_gpio_init_t gpio_spi_miso = {
    0,//0:GPIOA,1:GPIOB
    7,//x:PINx
    1,//0:intput,1:output,reserve,not support;
    2,//0:Anolog,1:input,2:pushpull,3:OD
    0,//reserve,not support;
    0,//0:GPIO_IT_NONE,1:GPIO_IT_RISING,2:GPIO_IT_FALLING
    0,//0:GPIO_PULL_NONE,1:GPIO_PULL_UP
    3,//af3
};
bsp_spi_init_t spi1 = {
    &gpio_spi_cs,
    &gpio_spi_sck,
    &gpio_spi_mosi,
    &gpio_spi_miso,
    3,//0: SPI_SCKSRC_PCLKDIV2,1: SPI_SCKSRC_PCLKDIV4,2: SPI_SCKSRC_PCLKDIV8,3: SPI_SCKSRC_PCLKDIV16,4: SPI_SCKSRC_PCLKDIV32,5: SPI_SCKSRC_PCLKDIV64,6: SPI_SCKSRC_PCLKDIV128,7: SPI_SCKSRC_PCLKDIV256
    0,//CPHA
    0,//CPOL
    4,//0: SPI_DATAWIDTH_4BIT,1: SPI_DATAWIDTH_5BIT,2: SPI_DATAWIDTH_6BIT,3: SPI_DATAWIDTH_7BIT,4: SPI_DATAWIDTH_8BIT,5: SPI_DATAWIDTH_9BIT,6: SPI_DATAWIDTH_10BIT,7: SPI_DATAWIDTH_11BIT,8: SPI_DATAWIDTH_12BIT,9: SPI_DATAWIDTH_13BIT,10: SPI_DATAWIDTH_14BIT,11: SPI_DATAWIDTH_15BIT,12: SPI_DATAWIDTH_16BIT
    0,//0: SPI_MASTER,1: SPI_SLAVE
    0,//0: SPI_FIRSTBIT_MSB,1: SPI_FIRSTBIT_LSB
    0,//0: FullDuplex,1:TXONLY,2:RXONLY,3:HalfDuplex
    0,//0: SPI_NCS_HARD_OUTPUT, 1:SPI_NCS_HARD_INPUT,SPI_NCS_SOFT
    SPI1_txbuf,
    SPI1_rxbuf,
};
void spi_test_init(void)
{
    bsp_Spi_Init(&spi1);
}
void test_spi_send_recv(void)
{
    for(int i=0;i<10;i++)
    {
        spi1.txbuf[i] = i;
    }
    bsp_spi_transmit(&spi1,spi1.txbuf,spi1.rxbuf,10);
}


